(ns clj-gallery.routes.home
  (:require [compojure.core :refer [defroutes GET]]
            [selmer.parser :refer [render-file]]

            [clj-gallery.views.layout :as layout]
            [clj-gallery.util :refer [thumb-prefix]]
            [clj-gallery.routes.gallery :refer [show-galleries]]
            [clj-gallery.models.db :as db]))

(defn home []
  (layout/render "home.html" {:thumb-prefix thumb-prefix
                              :galleries    (db/get-gallery-previews)}))

(defroutes home-routes
  (GET "/" [] (home)))